package com.dinggao.crossgo.module.roadbook.activity;

import android.os.Bundle;
import android.view.View;

import com.dinggao.crossgo.R;
import com.dinggao.crossgo.core.base.BaseActivity;
import com.dinggao.crossgo.core.constant.CommonConstant;
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class RoadBookPublishSuccessActivity extends BaseActivity {


    @Override
    protected int getLayoutResource() {
        return R.layout.activity_release_success;
    }

    @Override
    protected void onInitialization(Bundle bundle) {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.success_close_image, R.id.success_open_weixin})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.success_close_image:
                finish();
                break;
            case R.id.success_open_weixin:
                // TODO: 2018/8/3 打开微信小程序

                IWXAPI api = WXAPIFactory.createWXAPI(this, CommonConstant.WECHAT_APPID);

                WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
                req.userName = CommonConstant.WECHAT_XCXID; // 填小程序原始id
              //  req.path ="pages/teamdetail/teamDetail";                 //拉起小程序页面的可带参路径，不填默认拉起小程序首页
                req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版，体验版和正式版
                api.sendReq(req);

                break;
        }
    }
}
